package com.test.threadTest;

/**
 * @Description
 * @Author mzb
 * @Date 2020/5/16 16:50
 */

public enum EnumC {
    //--
    one(1,"小马"),two(2,"小花"),three(3,"小赵");

    private int index;
    private String name;


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    EnumC(int index, String name) {
        this.index = index;
        this.name = name;
    }
    public static EnumC getValue(int index){
        EnumC[] vals=EnumC.values();
        for(EnumC info:vals){
            if(index==info.getIndex()){
                return info;
            }
        }
        return null;
    }
}
